<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="/shop/include :: header"></head>
<body>
	<form class="layui-form" action="" lay-filter="shop_feedback-update-form" style="margin-top: 20px;">
		<input name="id" th:value="${shopFeedback.id}"
			type="hidden">
		<!--  -->
		<div style="display: flex">
			<!--  -->
			<div class="layui-form-item" style="display: contents">
				<label class="layui-form-label">图片：</label>
				<div class="layui-upload-list">
					<img class="layui-upload-img" th:src="${shopFeedback.images}" style="width: 300px;height: 300px">
					<input type="hidden" name="images" id="images" th:value="${shopFeedback.images}">
				</div>
			</div>
			<div style="width: 63%">
				<!--  -->
				<div class="layui-form-item">
					<label class="layui-form-label">用户ID：</label>
					<div class="layui-input-block">
						<input class="layui-input" lay-verify="required" autocomplete="off" id="userId"
							   th:value="${shopFeedback.userId}" name="userId"
							   placeholder="请输入用户ID" readonly>
					</div>
				</div>
				<!--  -->
				<div class="layui-form-item">
					<label class="layui-form-label">用户群体：</label>
					<div class="layui-input-block">
						<select name="userType" id="userType" placeholder="用户群体" disabled>
							<option th:selected="${shopFeedback.userType == 0}" value="0">用户</option>
							<option th:selected="${shopFeedback.userType == 1}" value="1">商户</option>
							<option th:selected="${shopFeedback.userType == 2}" value="2">供应商</option>
						</select>
					</div>
				</div>
				<!--  -->
				<div class="layui-form-item">
					<label class="layui-form-label">申请内容：</label>
					<div class="layui-input-block">
						<input class="layui-input" lay-verify="required" autocomplete="off" id="applyContent"
							   th:value="${shopFeedback.applyContent}" name="applyContent"
							   placeholder="请输入申请内容" readonly>
					</div>
				</div>
				<!--  -->
				<div class="layui-form-item">
					<label class="layui-form-label">处理状态：</label>
					<div class="layui-input-block">
						<select name="applyState" id="applyState" lay-filter="applyState" th:data="${shopFeedback.applyState}">
						</select>
					</div>
				</div>
			</div>
		</div>
 		<!--  -->
		<div class="layui-form-item">
			<label class="layui-form-label">平台回复：</label>
			<div class="layui-input-block">
				<textarea id="platformReply" name="platformReply" th:text="${shopFeedback.platformReply}" disabled></textarea>
			</div>
		</div>
 		<div class="layui-form-item" style="text-align: center">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="shop_feedback-update">立即提交</button>
			</div>
		</div>
	</form>
	<div th:include="/shop/include::footer"></div>
	<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
	<script>
		layui.use([ 'layer', 'jquery', 'form', 'laydate', 'layedit', 'dict'], function() {
			var $ = layui.jquery;
			var laydate = layui.laydate;
			var layer = layui.layer;
			var form = layui.form;
			var layedit = layui.layedit;
			var dict = layui.dict;

			dict.setSelect("applyState","applyState")
			var platformReply =  layedit.build('platformReply',{
				tool: [
					'strong' //加粗
					,'italic' //斜体
					,'underline' //下划线
					,'del' //删除线

					,'|' //分割线

					,'left' //左对齐
					,'center' //居中对齐
					,'right' //右对齐
					,'link' //超链接
					,'unlink' //清除链接
					,'face' //表情
				]
			}); //建立编辑器

			/*$("#LAY_layedit_1").contents().find("body[contenteditable]").prop("contenteditable", false);//jquery获取iframe里的内容*/
			//监听提交
			form.on('submit(shop_feedback-update)', function(data) {
				data.field.platformReply = layedit.getContent(platformReply);
				$.ajax({
					url: '/platform/feedback/edit',
					type: "post",
					data: JSON.stringify(data.field),
					contentType: 'application/json; charset=utf-8', // 很重要
					async: false,
					success: function (result) {
						if (result.status == "SUCCESS"){
							layer.msg(result.message, {
								offset: '15px'
								, icon: 1
								, time: 1000
							}, function () {
								window.parent.location.reload();
							});
						}else {
							layer.msg(result.message)
						}
					}
				});
				return false;
			});
		});
	</script>
</body>
</html>